//package com.welike.shibo.controller;
//
//import com.welike.shibo.eneity.JsonResult;
//import com.welike.shibo.service.VideoService;
//import com.welike.shibo.utils.IpUtil;
//import com.welike.shibo.utils.ResultUtils;
//import io.swagger.annotations.Api;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.ResponseBody;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import java.net.UnknownHostException;
//
///**
// * 测试Controller
// *
// * @author fangyu
// * @version v1.0.0
// * @since 2019-08-19 01:28
// */
//@Slf4j
//@Api(value = "测试接口")
//@Controller
//public class TestController {
//
////    @Autowired
////    private JwtUtil jwtUtil;
//
//    @Autowired
//    private VideoService videoService;
//
//    /**
//     * 测试登录
//     * 这里使用用户id来生成token
//     *
////     * @param userId
////     * @return
//     */
////    @PostMapping("/login")
////    public JsonResult login(Integer userId) {
////        try {
////            Map<String, Object> map = new HashMap<String, Object>(1);
////            map.put("token", jwtUtil.generateToken(userId + ""));
////            return ResultUtils.success(map);
////        } catch (Exception e) {
////            log.error("login error Exception:{}", e.getMessage());
////            return ResultUtils.error(404, e.getMessage());
////        }
////    }
//
//    @GetMapping("/api/test")
//    @ResponseBody
//    public JsonResult getTest(HttpServletRequest request) {
//        log.info(request.getHeader("Host"));
//        log.info(request.getRemoteHost());
//        log.info(IpUtil.getIpAddr(request));
//        try {
//            String city = IpUtil.getIpCity(request);
//            return ResultUtils.success(city);
//        } catch (UnknownHostException e) {
//            return ResultUtils.error("ip地址无");
//        }
//    }
//
//
//    @GetMapping("/share/{vid}")
//    public ModelAndView share(
//            Model model,
//            @PathVariable String vid
//    ) {
//        String videoUrl = videoService.queryVideoUrlByVid(vid);
//        String title = videoService.queryDescByVid(vid);
//        log.info("videoUrl ==> {}", videoUrl);
//        model.addAttribute("videoUrl", videoUrl);
//        model.addAttribute("title", title);
//        return new ModelAndView("mobile/share");
//    }
//
//}
